<style>
    .nav > li > a:hover{
        background-color: white;
    }
</style>
<?php if (AuthComponent::user('id')==$user['User']['id']){?>
    <h1>Solicitudes</h1>
    <br/>


    <!--   NOTIFICACIONES   -->

    <table class="table table-hover">
    <?php foreach ($requests as $request) {?>
        <tr>
            <td><?php
                echo $this->Html->image('icons/32x32/users.png', array('alt' => $request['UserFrom']['id'], 'border' => '0')) ;
                ?>
            </td>
            <td colspan="2"> <?php
                echo 'Invitación de '.
                        $this->Html->link($request['UserFrom']['username'],array('controller'=>'users','action'=>'view',$request['UserFrom']['id'])).
                    'para ser miembro del equipo: "'. $request['Team']['name'].'"';
                ?>
            </td>
            <td>
                <?php
                if ($request['Request']['accepted']==0) {
                ?>
                <ul class="nav nav-pills pull-right">

                        <li>
                            <?php echo $this->Form->postLink(
                                        '<i class="icon-ok"></i>Aceptar', //le image
                                        '/users/requestResponse/'.$request['Request']['id'].'/1', //,le url
                                        array('escape' => false,'confirm' => 'Are you sure?','class' => 'nav-pills'));

                                    ?>   
                        <li>
                            <?php echo $this->Form->postLink(
                                        '<i class="icon-remove"></i>Rechazar', //le image
                                        '/users/requestResponse/'.$request['Request']['id'].'/2', //,le url
                                        array('escape' => false,'confirm' => 'Are you sure?','class' => 'nav-pills'));

                                    ?>   
                        </li>
                    </ul>
                <?php
                }
                else{
                    if ($request['Request']['accepted']==1)
                        echo '<span class="label label-success">Aceptada</span>';
                    if ($request['Request']['accepted']==2)
                        echo '<span class="label label-important">Rechazada</span>';
                }
                ?>
            </td>
        </tr>
    <?php } ?>
    </table>


<?php } else {?>
    <br/>
    <div class="alert alert-info">
        Error de acceso.
    </div>
<?php } ?>
